<template>
  <h3>子组件</h3>
  <p>父级传值姓名：{{name}}<br/>年龄：{{age}}</p>
  <p><el-button @click="back">子传父</el-button></p>
</template>

<script lang="ts" setup>
import {ref} from 'vue'
console.log('执行了')
interface Props {
    name?: string,
    age:number
}
const { name = 'yang',age} = defineProps<Props>()
const emit = defineEmits({
  onEmitBack: null,
});
function back(){
    console.log('sbsbsb')
    emit('onEmitBack', { id: 123456 });
}
const count=ref(10)
function doubbleCount(){
  count.value*2
}
defineExpose({
  count,doubbleCount
})
</script>

<style>

</style>